import config
import requests
import unittest

from api.group_tutor import GroupTutor
from lib.writexhxtoken import WriteXhxToken


class Group_Tutor(unittest.TestCase):
    def setUp(self):
        self.session = requests.Session()

    def tearDown(self):
        self.session.close()

    def test01_groupTetor(self):
        data = {
            "admin_id": 5279,
            "tree_id": 655,
            "id": 472,
            "is_leader": 1
        }
        WriteXhxToken().update_token_in_json(1)
        cookie = config.load_config()["xhx_token"]
        respone = GroupTutor().groupTutor(self.session,data,cookie)
        respone_json = respone.json()
        print(respone_json)
        config.prints(respone)
        self.assertEqual(respone_json["error"],449,"状态码断言")
        if respone_json["error"] == 449:
            print(f'断言成功，实际结果为:{respone_json["error"]}')

